usm_ndarray.real and usm_ndarray.imag now set flags correctly#1355
Merged
ndgrigorian merged 1 commit intomasterfrom Aug 20, 2023
Merged
usm_ndarray.real and usm_ndarray.imag now set flags correctly#1355ndgrigorian merged 1 commit intomasterfrom
ndgrigorian merged 1 commit intomasterfrom
Conversation
- these functions were setting the flags of the output to the flags of the input, which is incorrect, as the output is almost never contiguous - added tests for this behavior
|
View rendered docs @ https://intelpython.github.io/dpctl/pulls/1355/index.html |
Collaborator
|
Array API standard conformance tests for dpctl=0.14.6dev4=py310ha25a700_2 ran successfully. |
oleksandr-pavlyk
approved these changes
Aug 20, 2023
Contributor
oleksandr-pavlyk
left a comment
There was a problem hiding this comment.
Good catch, @ndgrigorian !
It is reminds me that it is possible to set up real/imag values of complex arrays:
import dpctl.tensor as dpt
sp_vals = dpt.asarray([dpt.nan, -dpt.nan, dpt.inf, -dpt.inf, -1.0, -0.0, 0.0, 1.0], dtype="f4")
x = dpt.empty((sp_vals.shape[0], sp_vals.shape[0]), dtype="c8")
x.real[...] = sp_vals[:, dpt.newaxis]
x.imag[...] = sp_vals[dpt.newaxis, :]|
Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞 |
|
Array API standard conformance tests for dpctl=0.14.6dev4=py310ha25a700_2 ran successfully. |
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
realandimagproperties ofusm_ndarraywere setting the flags of the returned view incorrectly.In most cases, the output was not contiguous, but the input was, which caused most functions to behave incorrectly on views into the real or imaginary parts of complex arrays.
This PR corrects that, and also allows
realandimagto work on 0-dimensional arrays.